using System;
using System.ComponentModel;
using SmartLink.Domain.Attribute;
using SmartLink.EnumLibrary;

namespace SmartLink.Domain.Entity
{

    /// <summary>
    /// 通行证
    /// </summary>	
    [Serializable]
    [TableName("SYS_User")]
    public class SYS_User : BaseEntity
    {
        #region Model	

        /// <summary>
        /// 登录账户
        /// </summary>		
        [Description("登录账户")]
        public string AccountName { get; set; }

        /// <summary>
        /// 登录密码
        /// </summary>		
        [Description("登录密码")]
        public string PassWord { get; set; }

        /// <summary>
        /// 用户名称
        /// </summary>		
        [Description("用户名称")]
        public string NickName { get; set; }

        /// <summary>
        /// 用户EMail
        /// </summary>		
        [Description("用户EMail")]
        public string UserEmail { get; set; }

        /// <summary>
        /// 用户电话
        /// </summary>		
        [Description("用户电话")]
        public string UserPhone { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        public string JobNo { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public SexEnum Sex { get; set; } = SexEnum.Secret;

        /// <summary>
        /// 手机
        /// </summary>
        public string UserMobile { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        public DateTime? Birthday { get; set; }

        /// <summary>
        /// QQ
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// 微信
        /// </summary>
        public string WeChat { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>		
        [Description("最后登录时间")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 最后登录ip
        /// </summary>		
        [Description("最后登录ip")]
        public string LastLoginIP { get; set; }

        /// <summary>
        /// 用户状态
        /// </summary>		
        [Description("用户状态")]
        public UserStatusEnum UserStatus { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>		
        [Description("创建时间")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>		
        [Description("创建人")]
        public int Creator { get; set; }

        /// <summary>
        /// 删除标志
        /// </summary>		
        [Description("删除标志")]
        public bool IsDel { get; set; }

        /// <summary>
        /// 是否自己更新过密码
        /// </summary>
        public bool HasUpdatedPwdSelf { get; set; }

        /// <summary>
        /// 微信openID
        /// </summary>
        public string OpenID { get; set; }

        /// <summary>
        /// 用户类型 1:车主用户 2:后端用户
        /// </summary>
        public int UserType { get; set; }

        #endregion Model

        #region 扩展方法
        public void Create(int creatorId)
        {
            Creator = creatorId;
            CreateTime = DateTime.Now;
            HasUpdatedPwdSelf = false;
            IsDel = false;
        }
        #endregion
    }
}